<?php //$Id

/**
 * This file defines de main slides configuration form
 * It uses the standard core Moodle (>1.8) formslib. For
 * more info about them, please visit:
 * 
 * http://docs.moodle.org/en/Development:lib/formslib.php
 *
 * The form must provide support for, at least these fields:
 *   - name: text element of 64cc max
 *
 * Also, it's usual to use these fields:
 *   - intro: one htmlarea element to describe the activity
 *            (will be showed in the list of activities of
 *             emboodle type (index.php) and in the header 
 *             of the emboodle main page (view.php).
 *   - introformat: The format used to write the contents
 *             of the intro field. It automatically defaults 
 *             to HTML when the htmleditor is used and can be
 *             manually selected if the htmleditor is not used
 *             (standard formats are: MOODLE, HTML, PLAIN, MARKDOWN)
 *             See lib/weblib.php Constants and the format_text()
 *             function for more info
 */

require_once ('moodleform_mod.php');
//include_once 'SSUtil/SSUtil.php';
//include_once 'embood.php';
//include_once 'emboodfetcher.php';

?>
<meta HTTP-EQUIV="Expires" content="27 Aug 2007 00:00:00 GMT" />
<meta HTTP-EQUIV="Cache-Control" content="no-cache" />
<LINK href="../mod/emboodle/emboodle.css" rel="stylesheet" type="text/css">
<?php
/*
<!-- Combo-handled YUI JS files: --> 
<script type="text/javascript" src="http://yui.yahooapis.com/combo?2.7.0/build/yahoo/yahoo-min.js&2.7.0/build/event/event-min.js&2.7.0/build/connection/connection-min.js"></script> 


<!-- Combo-handled YUI CSS files: -->
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.7.0/build/logger/assets/skins/sam/logger.css">
<!-- Combo-handled YUI JS files: -->
<script type="text/javascript" src="http://yui.yahooapis.com/combo?2.7.0/build/yahoo/yahoo-debug.js&2.7.0/build/dom/dom-debug.js&2.7.0/build/event/event-debug.js&2.7.0/build/logger/logger-debug.js"></script>
<!-- Combo-handled YUI CSS files: -->
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.7.0/build/button/assets/skins/sam/button.css&2.7.0/build/logger/assets/skins/sam/logger.css">
<!-- Combo-handled YUI JS files: -->
<script type="text/javascript" src="http://yui.yahooapis.com/combo?2.7.0/build/yahoo/yahoo-debug.js&2.7.0/build/dom/dom-debug.js&2.7.0/build/event/event-debug.js&2.7.0/build/element/element-debug.js&2.7.0/build/button/button-debug.js&2.7.0/build/logger/logger-debug.js"></script>
*/
?>

<script type="text/javascript" src="http://yui.yahooapis.com/combo?2.7.0/build/yahoo-dom-event/yahoo-dom-event.js&2.7.0/build/connection/connection-min.js&2.7.0/build/json/json-min.js"></script>
<script type="text/javascript" src="../mod/emboodle/emboodle_form.js"></script>



<?php
class mod_emboodle_mod_form extends moodleform_mod {
	
	function definition() {
		global $COURSE;
		$mform   =& $this->_form;
 		//----------
 		$mform->addElement('hidden','warningplaceholder');
		     
        //---------
        //add a placeholder. once we retrieve the emboodle for the user, we put them here
        $mform->addElement('hidden','placeholder');
        
        $mform->addElement('html', '<div id=emboodle_title></div><div id=embedcontainer></div>');
        $embedcode=&MoodleQuickForm::createElement('hidden','embedcode' , '', "id=embedcode");
      	$mform->insertElementBefore($embedcode,'placeholder');
 		
 		//------------------------------------------------------------------------------
 		// add standard buttons, common to all modules    
        $includeGroups=false;
		$this->standard_coursemodule_elements($includeGroups);
        $this->add_action_buttons();
        //$argh=$mform->getElement('emboodtype')->getValue();
        //echo 'dfine form'.$argh[0].'<br/>';
	}
	
	function definition_after_data() {
		//most of our stuff ends up here, because many of the form fields depend on what they
		//pick for the first few forms
		parent::definition_after_data();
    	
    	$mform =& $this->_form;
         
		//***********************************
    	// Adding the "general" fieldset, where all the common settings are showed
		//***********************************    	
        $generalheader=&MoodleQuickForm::createElement('header', 'general', 
        	get_string('general', 'form'));
        $mform->insertElementBefore($generalheader,'placeholder');
 		/// Adding the standard "name" field
 		$linkfield=&MoodleQuickForm::createElement('hidden', 
													'link',
													get_string('emboodle_link', 'emboodle'), 
													array('size'=>'64','id'=>'id_link'));
        $mform->insertElementBefore($linkfield,'placeholder');
        $introfield=&MoodleQuickForm::createElement('text', 
													'intro',
													get_string('emboodle_share', 'emboodle'), 
													array('size'=>'64'));
		$namefield=&MoodleQuickForm::createElement('hidden', 
													'name',
													get_string('emboodle_title', 'emboodle'), 
													array('size'=>'64','id'=> 'id_name'));
        $mform->insertElementBefore($introfield,'placeholder');
        $mform->insertElementBefore($namefield,'placeholder');
		$mform->setType('name', PARAM_TEXT);
		$mform->addRule('intro', null, 'required', null, 'client');
    	/// Adding the optional "intro" and "introformat" pair of fields
    	/*$introfield=&$mform->createElement('textarea',
											'intro',
											 get_string('intro', 'slides'),
											'wrap="virtual" rows="10" cols="50"');
    	$mform->insertElementBefore($introfield,'placeholder');
    	$mform->setType('intro', PARAM_RAW);
		$mform->addRule('intro', get_string('required'), 'required', null, 'client');
        $mform->setHelpButton('intro', array('writing', 'richtext'), false, 'editorhelpbutton');
    	*/			
	
	}
	
	
}

?>




